﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="tab.aspx.cs" Inherits="GeoWeb.Demo.MainTemplate.templates_001.web.tab.tab" %>

<%@ Register Assembly="GeoWeb.Controls.WebGrid" Namespace="GeoWeb.Controls.WebGrid"
    TagPrefix="GeoStar" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="../../../../Script/GeoJS.js" type="text/javascript"></script>
    <script src="../../../../Script/jquery-1.7.1.min.js" type="text/javascript"></script>
    <link href="../index.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        $(function () {
            var TreeNodeID = GeoJS.common.queryURLString("configNodeId");
            //BindButtonList(TreeNodeID);
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="rightCentent">
        <div id="maintop" >
            <div id="mainTitle" runat="server" ></div>
            <div id="btnCommand" runat="server"></div>
        </div>
        <div>
            <GeoStar:WebGrid ID="WebGrid1" runat="server" AutoLoadData="True"
            DelayLoadData="False" DelayLoadTime="200" Width="800" Height="400" AutoGenerateColumns="True"
            MultiSelect="True" OnWebGridRefresh="WebGrid1_OnWebGridRefresh" PageSize="20"
            RowMultiLine="False" ShowCheckBox="True" PageIndex="1" FontSize="14"
            SortName="ISO" SortOrder="ASC" OnWebGridColumnCreated="WebGrid1_OnWebGridColumnCreated"
            PagerFormatString="共{0}条, 每页{1}条, 共{2}页, 第{3}页"
            MemoryStateAfterRefresh="True" onwebgridcellrendering="WebGrid1_WebGridCellRendering">
            
            <CallBacks OnBeforeLoad="OnBeforeLoad" OnAfterRefresh="OnAfterRefresh" OnRowClick="OnRowClick" />
            <Skin SkinCSSPath="../../../../WebGrid_Demo/Skins/Pink/Pink.css" SkinName="Pink" />
        </GeoStar:WebGrid>
        </div>
    </div>
    </form>
</body>
<script type="text/javascript">
    var r = 0;
    var g = WebGrid1.webGrid;
    var Btn_Click = function (o, a) {
        alert(a.data['Name']);
    };
    var OnBeforeLoad = function () {
        window.onresize();
        g.setQueryParams({ UID: '11' });
    };
    var OnAfterRefresh = function (o, a) {
//        if (r == 0) {
//            var select_Page = document.getElementById("select_Page");
//            select_Page.options.length = 0;
//            select_Page.options.add(new Option("gotoPage"));
//            for (var i = 1; i <= g.pageCount; i++) {
//                select_Page.options.add(new Option(i, i));
//            }
//            r++;
//        }
    };
    var OnRowClick = function (o, a) {
        //alert("lastCurrentRow-index: " + o.lastCurrentRow.index + "\ncurrentRow-index: " + o.currentRow.index);
    };

    window.onresize = function () {
        var w = document.documentElement.clientWidth || document.body.clientWidth,
            h = document.documentElement.clientHeight || document.body.clientHeight;
        g.reSizeTo({
            width: w - 20,
            height: h - 43
        });
    };

    if (!g.autoLoadData) {
        window.setTimeout(function () { g.refresh(); alert('延时5秒钟加载数据！'); }, 5000);
    }
    function getSelectedRows() {
        var rows = g.getSelectedRows();
        if (rows.length > 0) {
            var arr = [];
            for (var i = 0; i < rows.length; i++) {
                var _arr = ['"index":"' + rows[i].index + '"'];
                for (var it in rows[i].data) {
                    _arr.push('"' + it + '":"' + rows[i].data[it] + '"');
                }
                arr.push('  {' + _arr.join() + '}');
            }
            var str = '[\n' + arr.join(',\n') + '\n]';
            alert(str);
            window.eval('(' + str + ')');
        }
        else {
            alert('没有勾选任何行!');
        }
    }
    
</script>
</html>
